--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_TIME
-AC_CHECK_HEADERS([fcntl.h limits.h poll.h sys/ioctl.h sys/poll.h sys/time.h ])
+AC_CHECK_HEADERS([fcntl.h libudev.h limits.h poll.h sys/ioctl.h sys/poll.h sys/time.h ])
 AC_CHECK_HEADERS([syslog.h unistd.h util.h libutil.h pty.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -390,6 +390,10 @@
     AC_DEFINE(HAVE_SYSTEMD)
 fi
 
+PKG_CHECK_MODULES([LIBUDEV],[libudev],,[true])
+CFLAGS="$CFLAGS $LIBUDEV_CFLAGS"
+LIBS="$LIBS $LIBUDEV_LIBS"
+
 dnl Ubuntu's systemd pkg-config seems broken beyond repair. So:
 kernelversion=`cat /proc/version || echo "non-linux"`
 case $kernelversion in 
